package com.dongline.test.huizongliuliang;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class FlowReducer extends Reducer<Text,FlowWritable,Text,FlowWritable> {
    @Override
    protected void reduce(Text key, Iterable<FlowWritable> values, Context context) throws IOException, InterruptedException {
       long up=0;
       long down=0;
        for (FlowWritable value:values)
        {

            up=up+value.getUpflow();

            down=down+value.getDownflow();
        }
        context.write(key,new FlowWritable(up,down));
    }
}
